package com.etoak.common.jwt;

import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import io.jsonwebtoken.security.Keys;
import org.apache.commons.lang3.time.DateUtils;

import java.security.Key;

import java.util.Date;
import java.util.Map;

public class MyJwtUtil {
    public static final String STRING_KEY="11111111111111111111111111111111";
    public static final Key KEY= Keys.hmacShaKeyFor(STRING_KEY.getBytes());
    public static String create(Map<String,Object> claims){
        Date now = new Date();
        return Jwts.builder()
                .signWith(KEY)
                .setClaims(claims)
                .setIssuedAt(now)
                .setExpiration(DateUtils.addHours(now,12))
                .compact();
    }
}
